import * as React from "react";
import { PageContainer } from "./pageContainer";
import { HeaderComponent } from './head';
import { FooterComponent } from "./footer";
import { isString } from "util";
interface AppProps {}

interface AppState {
  page: string;
}

export default class Base extends React.Component<AppProps, AppState> {
  myRef: any;
  constructor(props: AppProps) {
    super(props);
    this.state = {
      page: "aModule"
    };
    this.myRef = React.createRef();
    console.log(this.myRef);    
    this.changePageFunction = this.changePageFunction.bind(this);
  }
  changePageFunction(o: any){
    if(isString(o)){
      this.setState({
        page:o
      })
    }
  }
  render() {
    return (
      <div className="baseContainer">
        <HeaderComponent />
        <PageContainer page={this.state.page} />
        <FooterComponent ref={this.myRef} changeFunc={this.changePageFunction}/>
      </div>
    )
  }
}

